<?php
/**
 * @author Thibaut Cromphaut, Gaïtano Boeraeve, Mathias Helin, Dimitry Dierickx
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent 
 */

class Application_Form_RegisterByAdmin extends Zend_Form
{
    public function init()
    {
        // Veld 'Voornaam'
        $this->addElement('text', 'givenname', array(
            'label'      => 'Voornaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));

        // Veld 'Familienaam'
        $this->addElement('text', 'familyname', array(
            'label'      => 'Familienaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));
        
        // UserEmail
        $this->addElement(new Application_Form_Element_UserEmail('emails', array(
            'label'      => 'Email:',
            'required'   => true,
            'value'      => "***1",
            'filters'    => array('StringTrim'),
            'validators' => array(new Ahs_Validators_UserEmail()),
        )));

        // Veld 'Wachtwoord'
        $this->addElement('password', 'password', array(
            'label'      => 'Wachtwoord:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(8, 45)),
            ),
        ));

        // Veld 'Wachtwoord (herhaal)'
        $this->addElement('password', 'passwordRepeat', array(
            'label'      => 'Wachtwoord (herhaal):',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(8, 45)),
                array('Identical', true, array('password')),
            ),
        ));
        
        // Secret question ID
        $this->addElement(new Application_Form_Element_SecretQuestionSelect('secretQuestion', array(
            'label'      => 'Geheime vraag:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                new Zend_Validate_Regex('/^[0-9]+$/'),
            ),
        )));
        
        // Veld 'Geheime vraag'
        $this->addElement('text', 'secretAnswer', array(
            'label'      => 'Geheim antwoord:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));
   
        // Veld 'Nieuwsbrief voorkeur'
        $this->addElement('checkbox', 'Prefnewsletter', array(
            'label'      => 'Stuur me de nieuwsbrief:',
            'required'   => false,
        ));
        
        // Veld 'Role'
        $this->addElement(new Application_Form_Element_RoleSelect('role'));
        
        // Active
        $this->addElement(new Application_Form_Element_ActiveSelect('active'));
        
        // Deleted
        $this->addElement(new Application_Form_Element_DeleteSelect('deleted'));

        // Knop 'Versturen'
        $this->addElement('submit', 'send', array(
            'label'      => 'Versturen',
        ));
        
        // CSRF-preventie (Cross-Site Request Forgery)
        /*
        $this->addElement('hash', 'no_csrf_registration', array(
            'salt' => 'unique',
        ));
        */
    }

}


